<template>
  <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body @close="close">
    <StaffChoose @onStaffChosen="childClick" :muilt="muilt" ref="staffChooseView" />
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取消</el-button>
      <el-button type="primary" @click="onSubmit">确认</el-button>
    </div>
  </el-dialog>
</template>
<script>
import StaffChoose from "../staffChoose/index.vue";
import dialogMixin from "../../../mixins/dialogMixin";
export default {
  components: { StaffChoose },
  mixins: [dialogMixin],
  props: {
    muilt: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      title: "",
      open: false,
      deptId: 0,
      userIds: [],
      users: [],
      dept: null,
    };
  },
  mounted() {},
  computed: {},
  methods: {
    newissue() {
      this.open = true;
      this.title = "选择值班用户";
    },
    showDialog(title) {
      this.open = true;
      this.$nextTick(() => {
        this.$refs.staffChooseView.resetCheck();
        this.title = title;
      });
    },
    onSubmit() {
      //计划管理页面
      if (this.muilt) {
        this.$emit("Unitpersonnel", this.deptId, this.userIds, this.users, this.dept);
      } else {
        this.$emit("Unitpersonnel", this.deptId, this.userIds[0], this.users[0], this.dept);
      }
      this.open = false;
    },
    newSelectperson() {
      this.open = true;
      this.title = "选择单位人员";
    },
    childClick(deptId, ids, users, dept) {
      this.deptId = deptId;
      this.userIds = ids;
      this.users = users;
      this.dept = dept;
    },
  },
};
</script>
<style scoped></style>
